Major release introducing a unified graph query system, architectural analysis capabilities, and significant CLI improvements for better LLM integration.#1
Conversation
Documents the key shifts: compact-first outputs, pipeline slimming, and DB staleness awareness. Explains why token economy is the priority. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add OutputFormat enum and OutputOptions shared helper - Add docs/output-contract.md specifying compact format rules - Update agent-facing commands to default to compact format: - hotspots, dead-code, coupling, callgraph, impact, context - Compact format: one line per item, bounded lists, stable IDs - JSON schema uses consistent field names (methodId, items, metadata) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add MethodResolver helper for consistent method resolution - Add --id option to context, callgraph, impact, similar commands - Resolution precedence: --id > exact match > substring match - Context command now prints method ID for agent copy-paste - Update output-contract.md and LLM-QUICKSTART.md with --id examples Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Save analysis metadata: analyzed_at, solution_path, tool_version, git_commit - Add 'status' command to show db info and staleness check - Staleness heuristics: git commit change, source file modification times - Add GitHelpers.GetCurrentCommitHash() and GetLastModifiedTime() - Compact, table, and JSON output formats supported Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add --stages option to analyze command (default: core) - core: all stages except clustering (fast, essential features) - full: all stages including intent clustering - Save stages metadata for status command - ClustersCommand shows helpful message when run after core analysis Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update LLM-QUICKSTART.md with new features (status, --stages, --id) - Trim README from 329 to 109 lines (67% reduction) - Add links to detailed docs (output-contract, LLM quickstart) - Focus README on essentials: install, quick start, command table Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ContextHandler: Include MethodId in output for agent copy-paste - QueryHandler hotspots: Compact one-line-per-item format - QueryHandler dead-code: Add top parameter, compact format - All handlers now default to bounded outputs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add SnapshotTests.cs with golden file comparisons for: - hotspots (compact/json) - dead-code (compact/json) - callgraph (compact/json) - impact (compact/json) - coupling (compact/json) - context (compact/json) - tree (compact) - Add snapshot update workflow: UPDATE_SNAPSHOTS=1 dotnet test - Add docs/snapshot-testing.md documenting the workflow - Fix CliCommandTests JSON key expectation (hotspots -> items) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements Task 74: Graph Traversal Engine with Configurable Strategies Core components: - TraversalTypes.cs: Direction, Strategy, Ranking enums - TraversalConfig.cs: Configuration record with validation - TraversalResult.cs: Node, Edge, and Result records - FilterConfig.cs: Namespace/type/accessibility filtering - GraphTraversalEngine.cs: BFS/DFS traversal with ranking Features: - BFS and DFS traversal strategies - Direction control: Callers, Callees, Both - Configurable depth limits and max results - Four ranking strategies: - BlastRadius: Transitive caller count - Complexity: Cognitive complexity from metrics - Coupling: Afferent + Efferent coupling - Combined: Weighted normalized combination - Session-level caching for performance - Filter support for namespaces, types, accessibility Tests: 37 new tests covering types, traversal, and ranking Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements Task 76.1: Core layer detection infrastructure - ArchitecturalLayer enum: Presentation, Application, Domain, Infrastructure, Shared, Unknown - LayerAssignment record for storing detection results - LayerDetector with pattern-based detection: - Default patterns for Clean Architecture/DDD - Type name hints (Controller, Repository, Handler suffixes) - Confidence scoring (1.0 for exact match, 0.5 for partial) - Dependency validation rules for Clean Architecture - 12 unit tests covering detection and validation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements Task 76.2: Storage methods for layer assignments Schema changes: - Add TypeLayers table (TypeId, Layer, Confidence, Reason) - Add IX_TypeLayers_Layer index IStorageService interface additions: - SaveLayerAssignmentsAsync - GetLayerAssignmentsAsync - GetLayerForTypeAsync StorageService implementation with proper transaction handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements RefineByDependencyDirectionAsync() that analyzes call graph dependencies between types and adjusts layer assignment confidence based on Clean Architecture dependency rules: - Lowers confidence when types violate allowed dependency directions (e.g., Domain depending on Infrastructure) - Boosts confidence for low-confidence types with consistent valid deps - Clamps confidence to minimum 0.1 to prevent negative values - Adds violation warnings to Reason field Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements LayersCommand following ICommandHandler pattern: - Displays type-to-layer assignments with confidence scores - Supports filtering by layer (--layer) and minimum confidence - Outputs in compact, table, JSON, or CSV formats - Shows violations with [!] marker in compact mode Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements blast radius computation using BFS on reverse call graph: - Counts direct and transitive callers for each method - Computes depth (max distance from entry points) - Identifies entry points (methods with no callers) that can trigger code - Performance: handles 1000+ methods in <2 seconds Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extends schema with BlastRadius and BlastDepth columns - Adds index on BlastRadius for efficient sorting - Implements SaveBlastRadiusAsync using UPSERT pattern - Updates GetMethodMetricsAsync to return blast radius data Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Adds ComputeBlastRadiusStage to AnalysisStageHelpers - Runs after StoreResultsStage when call graph is available - Shows verbose output with max blast radius and high-impact count - Persists results to Metrics table via SaveBlastRadiusAsync Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Hotspots command: - Adds --sort option (complexity|blast-radius|risk) - Shows blast radius in output when sorting by blast or risk - Includes risk score: complexity * log(blast_radius + 1) Context command: - Shows blast radius with depth and computed risk score Updates GetHotspotsWithThresholdAsync to include BlastRadius/BlastDepth and support custom sort ordering. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Defines complete query model with: - QuerySeed: starting points (MethodId, Pattern, Namespace, Cluster) - QueryExpand: traversal control (Direction, MaxDepth, Transitive) - QueryFilter: inclusion/exclusion rules (namespaces, types, complexity) - QueryRank: result ordering (BlastRadius, Complexity, Coupling, Combined) - QueryOutput: format and limits (Compact/Json/Table, MaxResults) Supporting enums: ExpandDirection, RankStrategy, QueryOutputFormat Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements validation rules: - Seed must have at least one non-null property - MaxDepth bounds (0-100) - MinComplexity <= MaxComplexity - No overlapping Include/Exclude namespaces - MaxResults bounds (1-1000) - Empty/whitespace checks for all string properties Includes ValidationResult record and extension method for fluent usage. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements GraphQueryExecutor that: - Validates GraphQuery via GraphQueryValidator before execution - Resolves seeds (MethodId, MethodPattern, Namespace, Cluster) - Translates GraphQuery to TraversalConfig for GraphTraversalEngine - Handles ExpandDirection.None to return seed-only results - Applies ranking strategies (Complexity, BlastRadius, Coupling, Combined) - Formats results with optional metrics and location info - Supports MaxResults limiting and execution time tracking Includes 19 comprehensive tests covering all query scenarios. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements QueryPlanCache with: - Thread-safe ConcurrentDictionary storage - LRU eviction when cache exceeds max size (default 100) - Time-based expiration (default 5 minutes) - SHA256-based query hashing (excludes Output settings) - Hit/miss tracking with GetStats() method GraphQueryExecutor integration: - Optional useCache parameter (default true) - ClearCache() and GetCacheStats() methods - Caches resolved seeds and expand direction Includes 13 QueryPlanCache tests and 4 caching integration tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GraphQuerySerializer provides: - JSON serialization with camelCase naming and enum strings - Deserialization with TryDeserialize error handling - JSON Schema generation (draft-07) with full property docs QueryCommand CLI command: - Execute queries from --query-file or inline JSON argument - --schema flag outputs JSON schema - Supports all output formats (compact, json, table) - Validates queries before execution Includes 13 serializer tests covering round-trip, enums, and schema. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
DependencyRuleEngine provides: - Glob pattern matching for source/target namespaces - Built-in Clean Architecture rules (12 default rules) - Custom rules via JSON file with includeDefaults option - Violation detection with file:line locations - Severity levels (Error, Warning, Info) check-deps CLI command: - --rules <file> for custom rules - --show-rules to display loaded rules - --sample to generate example rules.json - Groups violations by rule in output - JSON output format supported Includes 18 tests covering pattern matching, rule loading, and detection. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added --seed option for quick method pattern or ID matching - Added --depth, --direction, --rank, --top options for common parameters - Kept --json and --query-file for full JSON query support - Auto-detects pattern vs exact ID based on wildcards (* or ?) - Updated command description for agent usage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Exposes GraphQueryExecutor via MCP as cg_query tool - Supports seed pattern, direction, depth, rank, and top parameters - Auto-detects wildcards to use pattern vs exact ID lookup - Excludes test methods by default - Token-optimized compact response format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ProtectedZone model with DoNotModify, RequireApproval, Deprecated levels - JSON config loading from .ai-code-graph/protected-zones.json - Glob pattern matching for method/namespace/type identification - Methods for checking protection and filtering protected methods - 20 unit tests covering all functionality Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…d MCP - Context command: shows warning if method is in protected zone - Impact command: lists protected methods in blast radius - Callgraph command: marks protected methods in call graph - MCP cg_query: includes protection warnings in results Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added layer assignment with confidence score - Enhanced blast radius with entry points detection - Added architectural notes section with warnings for: - High blast radius (>50 callers) - High complexity (CC>15) - Protection zone status - Deprecated callee calls - Layer violation detection - Updated snapshot tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Updated CLI help text for search commands to point to query - Updated MCP tool descriptions to indicate search is fallback - Updated slash commands with deprecation notes - Updated CLAUDE.md with recommended workflow (query first) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
All tasks completed in this session: - Task 80: Graph-First Query CLI Command - Task 81: MCP Graph Query Tool - Task 79: Protected Zone Marking - Task 83: Architectural Summary in Context - Task 82: Deprecate Token Search - Task 71: Benchmark artifacts gitignore (was already done) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add missing slash commands: query, status, layers, check-deps - Update CLAUDE.md with all 21 user-facing commands - Update SetupClaudeCommand.cs to generate all command files - Add content generators for: impact, dead-code, coupling, diff, semantic-search, query, status, layers, check-deps Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Major release introducing a unified graph query system, architectural analysis capabilities, and significant CLI improvements for better LLM integration.
New Features
Graph Query System
Architectural Analysis
CLI Improvements
MCP Enhancements
Documentation
Testing
Test plan